home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Getting Started / MPW Development / Build Guide next >
Encoding:
Text File  |  1996-04-26  |  11.4 KB  |  168 lines  |  [TEXT/ttxt]

  1. OpenDoc
  2. Development
  3. Framework
  4.                                                                                                                                                                                      
  5. Build Guide for MPW
  6. ODF Release 1                                                                                                                                                             
  7.  
  8. This document provides instructions for creating new parts and building them with MrC for PowerPC and SCpp for 68K. Before reading this document, first read the Installation Guide for MPW to properly configure your MPW and ODF environments. 
  9.  
  10.  
  11. Table of Contents
  12. -------------------------
  13. • Creating a New Part
  14.    • Using PartMaker
  15.    • Adding New Files to Your Project
  16.    • FWBuild Makefiles
  17.    • Updating Your NMAP Resources
  18. • Building Your Part
  19. • Running Your Part
  20. • Building ODF
  21.  
  22.  
  23. Creating a New Part
  24.  
  25. Whenever you want to create a new part, use PartMaker to generate your initial project. PartMaker is located in the PartMaker folder and contains five templates: two for creating a non-embedding part based on the ODFHello and ODFNothing examples, and three for creating an embedding part based on ODFContainer, ODFEmbed, and ODFTable. 
  26.  
  27.    1) Use PartMaker to generate a new project.
  28.    2) Add any new files to your project.
  29.    3) Update your Binding resources.
  30.  
  31. Note: Any parts you make must be created in the ODFDev folder. This is because the MPW make files assume that your project is located there. 
  32.  
  33.  
  34. Using PartMaker
  35.  
  36. ATTENTION: you must use the PartMaker 4.4.1 provided in the PartMaker folder. Earlier versions of PartMaker will not work correctly with the ODF Release 1 templates.
  37.  
  38. Simply double-click one of the PartMaker templates, and PartMaker will prompt you for information about your new part. Specify the name of your new part and your company name and press the "Create Part" button. PartMaker will prompt you for the name and location of your new project folder (Save File As:) and then create the project files.
  39.  
  40. Once you create your part, you should not change the part or company name. PartMaker uses this information in the source code to uniquely identify your part to OpenDoc. If you need to change the name of the part, use PartMaker again to create a new part and copy any new material you had written to the new project.
  41.  
  42. Once you have your new project (and before you add any new material to the part), launch MPW and build the part. This step allows you to verify that the part was generated correctly and does run. It also allows you to make an alias to the resulting part editor and add it to your Editors folder. See the section Building Your Part, later in this file, for more information on building your part editor.
  43.  
  44.  
  45. Adding New Files to Your Project
  46.  
  47. Once you have a new project, you can add new source files to this project by adding the files to your project makefile (MacMake.bmk). You can also add both native resource files (.r extension) and ODF cross-platform resource files (.fr extension).
  48.  
  49.  
  50. Adding Source Files
  51.  
  52. To add a new .cpp file to your makefile, you have to add the corresponding object file to the list of Component Objects in your makefile. If you look at the MacMake.bmk file that came with your project, you will see a variable called __ComponentObjects, which is set to a series of files whose endings are .cpp.o. Each of these files is an object file that is generated from the corresponding .cpp file. When you add a file to this list, the ODF build system automatically compiles the source file and links the resulting object file into your part. 
  53.  
  54. ODF puts object files in the directory specified by the _FWObjDir variable. You should put any new object files in this directory as well. Simply copy the syntax of an existing element in the __ComponentObjects list when adding new source files. For example if you add a new source file called MySourceFile.cpp, your makefile should look like the following:
  55.  
  56. __ComponentObjects = ∂
  57.         "{_FWObjDir}SOMPart.cpp.o ∂
  58.         "{_FWObjDir}MySourceFile.cpp.o ∂
  59.                    ... other source files...
  60.  
  61. If your source file relies on header files that are not located in your project's Sources folder, you will need to tell the ODF build system where these headers are. You do this by adding the header file directory to the __IncludeDirs list. By default, this list contains the directories for the ODF header files and for the directory containing your source files (specified by the _FWTargetDir variable). 
  62.  
  63. Similarly, if you have header files that you use specifically when compiling IDL or Resource files, you can add the header directory to the __IDLIncludeDirs or __FWRCIncludeDirs variables, respectively. 
  64.  
  65.  
  66. Adding ODF Resource Files
  67.  
  68. ODF resource files are normal text files that have an .fr extension and contain ODF cross-platform resources. The ODFRC plugin compiles these files into binary resources, which then get linked into your part editor. To add a new resource file to your project, add the name of the resulting binary resource file to the __ComponentResources variable list. The name of the resource file must have the extension .rsrc for the build system to compile the resource. For example, if you define a resource file named MyViews.fr, your makefile should look like the following:
  69.  
  70. __ComponentResources = ∂
  71.         "{_FWObjDir}Part.rsrc ∂
  72.         "{_FWObjDir}MyViews.rsrc ∂
  73.                    ... other resource files...
  74.  
  75. You can add both ODF resource files (.fr extension) and platform-specific resource files (.r extension) in this way. ODF compiles each file using the appropriate tool, based on the filename extension.
  76.  
  77. If your resource file relies on header files that are not located in your project's Sources folder, add the header file directory to the __FWRCIncludeDirs variable. 
  78.  
  79. Using AppMaker for Visual Editing of Views: See the AppMaker folder inside "Tools & Goodies" for a demo version of  Bowers Development's AppMaker and information on how to use it with PartMaker to create your part's interface.
  80.  
  81.  
  82. Adding IDL Files
  83.  
  84. The only time you should add IDL files is if your part defines an extension. You should NEVER modify ODF's IDL files or the IDL files that were generated by PartMaker; use C++ to modify the functionality of your part instead. If you are creating an extension for your part, you can simply add the IDL file(s) to your makefile and add the generated .cpp file(s) to your list of compilation targets. 
  85.  
  86. For example, to add an IDL file called MyExtension.idl to your makefile, you would want to add the following dependencies to your makefile:
  87.  
  88. "{_FWTargetDir}MyExtension.xih" ƒ "{_FWTargetDir}MyExtension.idl"
  89. "{_FWTargetDir}MyExtension.xh" ƒ "{_FWTargetDir}MyExtension.idl"
  90. "{_FWTargetDir}Sources:MyExtension.cpp" ƒ "{_FWTargetDir}MyExtension.idl"
  91. "{_FWTargetObjectsDir}MyExtension.cpp.o" ƒ ∂
  92.         "{_FWTargetDir}MyExtension.xh" ∂
  93.         "{_FWTargetDir}MyExtension.xih"
  94.  
  95. You would also add the MyExtension.cpp.o file to the list of Component Objects as you would for any other source file.
  96.  
  97. If your IDL file relies on header files that are not located in your project's Sources folder, add the header file directory to the __IDLIncludeDirs variable. 
  98.  
  99.  
  100. FWBuild MakeFiles
  101.  
  102. The FWBuild script works in conjunction with the MPW tool FWTool to compile the files of your project and output your part's shared library. To get a list of options for FWBuild, specify the -help option on the command line. FWBuild uses the compilation and make rules defined in the files MacMake.rul and MacMake.dfn to compile your source files and resources. You should not need to change the contents of these files. FWBuild, FWTool, MacMake.rul, and MacMake.dfn are all located in the "ODFDev:ODF:Tools:Mac:" folder. 
  103.  
  104. The preceding sections described the process for adding source files to your part. This section explains the purpose of a few of the other variables declared in a standard ODF makefile for the Mac OS.
  105.  
  106. __ComponentName
  107. This variable defines the name of the resulting part editor. 
  108.  
  109. You also use this name in conjunction with a specific extension to build different portions of your project.  The following is a list of extensions and the corresponding build target:
  110.  
  111.    .CFM - Builds your part's shared library (the most common target).
  112.    .IDE - Compiles your part's resources and IDL files only.
  113.    .RSED - Compiles only the resource files (both Rez and ODFRC).
  114.    .SOM - Compiles only the IDL files (used by SOMobjects™ TS plugin for CodeWarrior)
  115.    .LIB - Builds your part into a static library instead of a dynamic library; otherwise identical to .CFM
  116.  
  117. For example, to build the shared library of a part called MyPart, you would issue the following statements on your MPW command line:
  118.  
  119.     directory "{MyPartDirectory}"
  120.     FWBuild MyPart.CFM
  121.  
  122. __ComponentSignature
  123. This variable defines the creator type of the part editor and is of type OSType.
  124.  
  125. __CFMInitFunction
  126. Used internally to initialize your code fragments.  DO NOT MODIFY!!
  127.  
  128.  
  129. Updating Your NMAP Resources
  130.  
  131. Whenever you create a new part, PartMaker creates a set of 'nmap' resources for your part. However, because the content of your part is likely to be different than the default content of the PartMaker part, you must change these resources to reflect your part's content. See the Modifying Your Resources document in the "Documentation:Development Notes:" folder for more information on how to do this.
  132.  
  133.  
  134. Building Your Part
  135.  
  136. For your convenience, all projects come with a special script, called Build, which builds your part's shared library. In your project folder, you will find folders for each of the possible project configurations. To build a debug version of your part for PowerPC, open the project file in the MCPPCDebug folder and execute the Build script. To build a debug version of your part for 68K, open the project file in the SC68KDebug folder and execute the Build script there. You can build release versions of your part by executing the Build script in the corresponding Release folder. 
  137.  
  138. After MPW builds your part, make an alias to your part editor and put the alias in your Editors folder. If you do this, you will not have to copy your part to the Editors folder each time you recompile. The alias will automatically lead OpenDoc to the updated part editor file. 
  139.  
  140. Note: Remember that you also have to have the ODFLibrary (or an alias to it) in your Editors folder as well. ODF parts will not run without this library being present. 
  141.  
  142.  
  143. Running Your Part
  144.  
  145. To run your part, you need to first create a stationery file for your part editor. You do this by dropping your part editor onto the OpenDoc launcher located inside your system Extensions folder. OpenDoc creates a new stationery file for your part and puts it into your Stationery folder. 
  146.  
  147. Double click your part's stationery file to launch your part in a new document. 
  148.  
  149. When you ship your part, include the (release) ODFLibrary with it. Users can copy this library into their Exensions folder; users should copy your part editor into their Editors folder. The use of aliases is only for developers to alleviate the need to copy the part editor to the Editors folder after each compile.
  150.  
  151.  
  152. Building ODF
  153.  
  154. To rebuild ODF (debug version)  enter the following line:
  155.  
  156. for Symantec
  157.  
  158.             "{ODFDev}SC68KBuildAll" Debug Clean NoExamples 
  159.     
  160. for MRC
  161.  
  162.             "{ODFDev}MCPPCBuildAll" Debug Clean NoExamples 
  163.  
  164. If you also want to rebuild all the ODF examples  remove the NoExamples keyword
  165.  
  166.  
  167. © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  168. Apple, the Apple Logo, Macintosh, and OpenDoc are trademarks of Apple Computer, Inc., registered in the United States and other countries.